<?php
    $use = $_POST['username'];
    $pass = $_POST['pass'];

    $con = mysqli_connect('localhost','xin','123456','xin');
    $sql =  "SELECT * FROM `user` WHERE `name`='$use'";
    $res = mysqli_query($con,$sql);
    $row = mysqli_fetch_assoc($res);
    if($row){
        header('location:html/2.3denglu.html');
        die('用户存在');
    }
    $sql1 = "INSERT INTO `user` VALUES(null,'$use','$pass')";
    $res1 = mysqli_query($con,$sql1);
    if($res1){
        print_r('注册成功');
    }
?>